/******************************************************************************
Project    : Real time rtsp server library base on live555
*******************************************************************************
File Name    :  <VideoRTimeFramedSource.h>:  video real time framed source head file
Module Name  :  
Description  :  None
History      :
 No.   Ver.     Date        Designed by  Comment
-----+--------+----------+------------+---------------------------------------
 001   0.00.01  05/25/2015  <3G@LIURENHUA>   <video real time framed source head file>
*******************************************************************************/
#ifndef _VIDEO_FRAMED_RTIME_SOURCE_H
#define _VIDEO_FRAMED_RTIME_SOURCE_H

#include <FramedSource.hh>
#ifdef LOCAL_SOCK_INPUT
#include <LocalUdpSocket.h>
#endif /* LOCAL_SOCK_INPUT */

#include "RealTimeRtspServer_common.h"
/******************************************************************************
  macro define
 ******************************************************************************/
#define MAX_VFRAME_SIZE	(1024 * 256  )
#define NOCARE_FRM_RATE
#define SCHED_NODELAY

//#define SAVE_FILE_ENB
/******************************************************************************
  class declaration
 ******************************************************************************/
class VideoRTimeFramedSource : public FramedSource
{
public:
	virtual unsigned int maxFrameSize() const{return MAX_VFRAME_SIZE;};
	/* Constructor function */
	VideoRTimeFramedSource(UsageEnvironment & env,
#ifdef LOCAL_SOCK_INPUT
							const char  *pcIdentity,
#endif /* LOCAL_SOCK_INPUT */
							const u_int8_t ucFrmRate,
#ifdef LOCAL_SOCK_INPUT
							const u_int32_t unSBufSize,
							const u_int32_t unRBufSize
#else
							queue_t *pstQue
#endif /* LOCAL_SOCK_INPUT */
							);
	/* Destructor function */
	virtual ~VideoRTimeFramedSource();
	virtual void doGetNextFrame();
	virtual void GetFrameData();

#ifdef NOCARE_FRM_RATE
#else
private:
	static void getNextFrame(void * clientData);
#endif /* NOCARE_FRM_RATE */
	
private:
#ifdef LOCAL_SOCK_INPUT
	/* Local socket object pointer */
	LSOCK_OBJECT_st *pstServer;
#else
	queue_t *m_que;
#endif /* LOCAL_SOCK_INPUT */
	/* Left time value */
	u_int32_t m_unLeftTime;
	/* Frame rate */
	u_int32_t m_unFrmRate;
#ifdef SAVE_FILE_ENB
     int fd;
#endif /* SAVE_FILE_ENB */
};
#endif /* _VIDEO_FRAMED_RTIME_SOURCE_H */
